package com.cloud.cmt.usermanage.service.impl;

import com.cloud.cmt.usermanage.entity.Organization;
import com.cloud.cmt.usermanage.entity.Right;
import com.cloud.cmt.usermanage.service.OrganizationRepository;
import com.cloud.cmt.usermanage.service.RightRepository;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * User: wcy
 * Date: 2017/11/12
 * Time: 15:02
 */
@Service
public class RightServiceImpl {
    @Resource
    RightRepository rightRepository;
    public List<Right> getRightTree(Long uplink){
        List<Right> rights = rightRepository.findByUplink(uplink);
        for(Right right:rights){
            right.setChildren(getRightTree(right.getId()));
        }
        return rights;
    }
}
